
import { _decorator, Component, Node, Graphics, Material, EffectAsset, Sprite } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('Draw')
export class Draw extends Component {
    @property(EffectAsset)
    effect: EffectAsset = null!;

    material: Material = null!;

    dissolveNum: number = 0;

    start () {
        // const mat = new Material();
        // mat.initialize({ effectAsset: this.effect, defines:{ USE_TEXTURE: true } });

        const spComp = this.getComponent(Sprite);
        this.material = spComp.customMaterial;
    }

    update (deltaTime: number) {

        this.dissolveNum += 0.005;
        this.material.setProperty('dissolveThreshold', this.dissolveNum);

    }
}
